package it.getta.vicinometro.tracking;


import it.getta.vicinometro.model.LocationInfo;
import it.getta.vicinometro.utils.IntentParser;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

public class TrackingReceiver extends BroadcastReceiver {

	private ReceiverCallback mReceiverCallback;
	
	public TrackingReceiver(ReceiverCallback callback) {
		mReceiverCallback = callback;
	}
	
	@Override
	public void onReceive(Context ctx, Intent intent) {
		
		System.out.println("onReceive: " + intent.getAction());
		LocationInfo infos = IntentParser.parseIntent(intent);
	    mReceiverCallback.onNewLocationReceived(infos);
	}

	public interface ReceiverCallback {
		public void onNewLocationReceived(LocationInfo locationInfo);
	}
	
}
